package com.hrp.config;

import com.hrp.MyRule.MyRule;
import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * MySpringCloud
 *
 * @Title: com.hrp.config
 * @Date: 2020/5/23 5:57
 * @Author: wfg
 * @Description:
 * @Version:
 */
@ComponentScan("com")
@Configuration
public class UserConfig {


    @Bean
    @LoadBalanced
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }


//    @Bean
//    public TomcatServletWebServerFactory tomcat(){
//        TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
//        tomcat.setPort(8082);
//        return tomcat;
//    }
    @Bean
    public IRule iRule(){
        //return  new RandomRule();
        return new MyRule();
    }
}
